Transforming Data in a List Box

Description

The owner-draw string can be used to transform the data that is displayed in a list box. For example, consider the following list box, which displays a list of names. The input data consists of data in the format 'lastname, firstname'. We want to number the rows in the list box and display the data in the format 'firstname lastname'.

list = <<%str%
Smith,Jenny
Jones,Michelle
Amira,Stone
Krayzelberg,Lawson
%str%
ui_dlg_box("Names",<<%dlg%
[%O={@#} : {@$(,)+1} {@1,$(,)-1} ;%.30,10:name^#list];
[.30name];
<10OK>
%dlg% )

This script produces the following dialog:

images/XD_Transforming data in a listbox.gif

In this example, the owner-draw string displays the row number ({#}), then a space, then a colon, then the text starting at the character after the first comma till the end of the string ({@$(,)+1}), then a space, then the text from the beginning of the input string till the character before the first comma ({@1,$(,)-1}).

Limitations

Desktop applications only

See Also